<template>
    <a-modal v-model:open="visible" title="新增看板"  width="320px" @ok="handleConfirm">

        <a-input v-model:value="name" placeholder="请输入看板名称"/>
    </a-modal>
</template>

<script>
import { Modal,Input } from 'ant-design-vue';
import { createBoard } from '@/api/board';

export default{
    components: {
        AModal: Modal,
        AInput: Input
    },
    data(){
        return {
            name: "",
            visible: false,
        }
    },
    methods:{
        open(){
            this.visible = true;
        },
        handleConfirm(){
            if (this.name!==''){
                createBoard({
                    name: this.name
                }).then(res=>{
                    if (res.code === 0){
                        this.visible = false;
                        this.$emit("success")
                    }
                })
            } else {
                this.$message.warn("不能为空！")
            }

        }
    }
}
</script>
